//2009/09/27 20:21:46
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <math.h>
#include <sstream>
#include <algorithm>

using namespace std;

class OddDivisors
{
public:
    long long findSum(int N)
    {
        return sum(N);
    }
    long long get(int x)
    {
        int n=(x-1)/2;
        n++;
        return (x+1)*1LL*n/2;
    }
    long long sum(int b)
    {
        if (b==1) return 1;
        if (b==2) return 2;
        if (b&1) return sum((b-1)/2) + get(b);
        else return sum(b/2) + get(b-1);
    }
};

